<?php
class Crb_Db extends Zend_Db_Table 
{
    public function __construct($name)
    {
         Logger_Common::log("Table name Requested:: " . $name);
        
        if (is_string($name) )
        {
            if (Crb_Lang::current() !== "ru" && Crb_Lang::current() != null  )
            {
                if (!$this->isCoreTable($name) )
                $name = Crb_Lang::current() . "_" . $name; 
            }
        }
        
        $this->_name = $name;
        
        Logger_Common::log("Table name :: " . $name);
       return  parent::__construct($name);
    } 
    
    public function isCoreTable($Table)
    {
        $List = Zend_Registry::get('config')->coreTables;
        
        Logger_Common::log("CTL :: " . print_r($List,1));
        
        
        
        foreach ($List as $Item)
        {
            if ($Item == $Table) return true;
        }
        
        return false;
    }
    
    

}